# == Class: dirlink
#
# Full description of class dirlink here.
#
# === Parameters
#
# Document parameters here.
#
# [*sample_parameter*]
#   Explanation of what this parameter affects and what it defaults to.
#   e.g. "Specify one or more upstream ntp servers as an array."
#
# === Variables
#
# Here you should define a list of variables that this module would require.
#
# [*sample_variable*]
#   Explanation of how this variable affects the funtion of this class and if
#   it has a default. e.g. "The parameter enc_ntp_servers must be set by the
#   External Node Classifier as a comma separated list of hostnames." (Note,
#   global variables should be avoided in favor of class parameters as
#   of Puppet 2.6.)
#
# === Examples
#
#  class { dirlink:
#    servers => [ 'pool.ntp.org', 'ntp.local.company.com' ],
#  }
#
# === Authors
#
# Author Name <author@domain.com>
#
# === Copyright
#
# Copyright 2013 Your name here, unless otherwise noted.
#
class dirlink (
   $besfs2link    =  true,
)
{
   file {'/besfs2':
     ensure   => link,
     force  => true,
     target   => "/besfs8/offline/data/besfs2",
   }
   file {'/besfs3':
     ensure   => link,
     force  => true,
     target   => "/besfs8/offline/data/besfs3",
   }

case $facts['os']['release']['major']{
'7':{
    file {'/scratch':
      ensure   => link,
      force  => true,
      target   => "/tmp",
    }
    file {'/tmp':
      ensure   => "directory",
      owner    => 0,
      group    => 0,
      mode     => '1777',
    }
  }
'9':{
    file {'/scratch':
      ensure   => "directory",
      owner    => 0,
      group    => 0,
      mode     => '1777',
    }
    file {'/scratch/tmp':
      ensure   => "directory",
      owner    => 0,
      group    => 0,
      mode     => '1777',
    }
    file {'/tmp':
      ensure   => link,
      force  => true,
      target   => "/scratch/tmp",
    }
  }
}
   file {'/dybfs':
     ensure   => "directory",
     owner    => 0,
     group    => 0,
     mode     => '0755',
     before   => File['/bio'],
   } 

   file {'/dybfs/users':
     ensure   => link,
     force  => true,
     target   => "/dybfs2/users",
     require  => File['/bio']
   } 

   file {'/dybfs/rec':
     ensure   => link,
     force  => true,
     target   => "/dybfs2/rec",
     require  => File['/bio']
   }

   file {'/ybj':
     ensure   => "directory",
     owner    => 0,
     group    => 0,
     mode     => '0755',
     before   => File['/bio'],
   }

   file {'/hxmt':
     ensure   => "directory",
     owner    => 0,
     group    => 0,
     mode     => '0755',
     before   => File['/bio'],
   }

   file {'/mbh':
     ensure   => "directory",
     owner    => 0,
     group    => 0,
     mode     => '0755',
     before   => File['/bio'],
   }
   file {'/cac':
     ensure   => "directory",
     owner    => 0,
     group    => 0,
     mode     => '0755',
     before   => File['/bio'],
   }
   file {'/nano':
     ensure   => "directory",
     owner    => 0,
     group    => 0,
     mode     => '0755',
     before   => File['/bio'],
   }
   file {'/map':
     ensure   => "directory",
     owner    => 0,
     group    => 0,
     mode     => '0755',
     before   => File['/bio'],
   }

   file {'/atlas':
     ensure   => "directory",
     owner    => 0,
     group    => 0,
     mode     => '0755',
     before   => File['/bio'],
   }

   file {'/lhcb':
     ensure   => "directory",
     owner    => 0,
     group    => 0,
     mode     => '0755',
     before   => File['/bio'],
   }


   file {'/cms':
     ensure   => "directory",
     owner    => 0,
     group    => 0,
     mode     => '0755',
     before   => File['/bio'],
   }
   #file { "/herdfs/user":
   #  ensure   => absent,
   #}
   #file { "/herdfs/data":
   #  ensure   => absent,
   #}

   #file { "/epfs/user":
   #  ensure   => absent,
   #}
   #file { "/epfs/data":
   #  ensure   => absent,
   #}


   file {'/bio':
     ensure   => "directory",
     owner    => 0,
     group    => 0,
     mode     => '0755',
   }
   file { "/ybj/argo1":
     ensure   => absent,
   }
   file { "/ybj/argo10":
     ensure   => absent,
   }
   file { "/ybj/argo12":
     ensure   => absent,
   }
   file { "/ybj/mc1":
     ensure   => absent,
   }
   file { "/ybj/mc2":
     ensure   => absent,
   }
   file { "/ybj/public":
     ensure   => absent,
   }
   file { "/ybj/argod01":
     ensure   => absent,
   }
   file { "/ybj/argod02":
     ensure   => absent,
   }
   file { "/ybj/argod03":
     ensure   => absent,
   }
   file { "/ybj/argod04":
     ensure   => absent,
   }
   file { "/ybj/argod05":
     ensure   => absent,
   }
   file { "/ybj/argod06":
     ensure   => absent,
   }
   file { "/ybj/argod07":
     ensure   => absent,
   }
   file { "/ybj/argod08":
     ensure   => absent,
   }
   file { "/ybj/argod09":
     ensure   => absent,
   }
   file { "/ybj/argod10":
     ensure   => absent,
   }
   file { "/ybj/argod11":
     ensure   => absent,
   }
   file { "/ybj/argod12":
     ensure   => absent,
   }
   file { "/ybj/argod13":
     ensure   => absent,
   }
   file { "/ybj/argod14":
     ensure   => absent,
   }
   file { "/ybj/argod15":
     ensure   => absent,
   }
   file { "/ybj/argod16":
     ensure   => absent,
   }
   file { "/ybj/argod17":
     ensure   => absent,
   }
   file { "/ybj/argod18":
     ensure   => absent,
   }
   file { "/ybj/argod19":
     ensure   => absent,
   }
   file { "/ybj/argod20":
     ensure   => absent,
   }
   file { "/ybj/argod21":
     ensure   => absent,
   }
   file { "/ybj/argod22":
     ensure   => absent,
   }
   file { "/ybj/argod23":
     ensure   => absent,
   }
   file { "/ybj/argod24":
     ensure   => absent,
   }
   file { "/ybj/argod25":
     ensure   => absent,
   }
   file { "/ybj/argod26":
     ensure   => absent,
   }
   file { "/ybj/argod27":
     ensure   => absent,
   }
   file { "/ybj/argod28":
     ensure   => absent,
   }
   file { "/ybj/argod29":
     ensure   => absent,
   }
   file { "/ybj/argod30":
     ensure   => absent,
   }
   file { "/ybj/argod31":
     ensure   => absent,
   }
   file { "/ybj/argod32":
     ensure   => absent,
   }
   file { "/ybj/argod33":
     ensure   => absent,
   }
   file { "/ybj/argod34":
     ensure   => absent,
   }
   file { "/ybj/argod35":
     ensure   => absent,
   }
   file { "/ybj/argod36":
     ensure   => absent,
   }
   file { "/ybj/argod37":
     ensure   => absent,
   }
   file { "/ybj/argod38":
     ensure   => absent,
   }
   file { "/ybj/argod39":
     ensure   => absent,
   }
   file { "/ybj/argod40":
     ensure   => absent,
   }
   file { "/ybj/ybjx01d":
     ensure   => absent,
   }
   file { "/ybj/ybjx02d":
     ensure   => absent,
   }
   file { "/ybj/ybjx03d":
     ensure   => absent,
   }
   file { "/ybj/ybjx04d":
     ensure   => absent,
   }
   file { "/ybj/ybjx05d":
     ensure   => absent,
   }
   file { "/hxmt/data":
     ensure   => link,
     target   => "/hxmtfs/data",
     force    => true,
     require  => File['/bio'],
   }
   file { "/mnt/hxmt":
     ensure   => link,
     target   => "/eos/hxmt",
     force    => true,
     require  => File['/bio'],
   }
   file { "/hxmt/work":
     ensure   => link,
     target   => "/eos/hxmt/work",
     force    => true,
     require  => File['/bio'],
   }
   file { "/hxmt/soft":
     ensure   => link,
     target   => "/cvmfs/hxmt.ihep.ac.cn",
     force    => true,
     require  => File['/bio'],
   }
   file { "/home/bes":
     ensure   => link,
     #target   => "/ihepbatch/bes",
     target   => "/besfs5/homebes",
     force    => true,
     require  => File['/bio'],
   }
   file { "/home/lhc":
     ensure   => link,
     target   => "/ihepbatch/lhc",
     force    => true,
     require  => File['/bio'],
   }
   file { "/home/hxmt":
     ensure   => link,
     target   => "/hxmtfs/home",
     force    => true,
     require  => File['/bio'],
   }
   file { "/hxmt/home":
     ensure   => link,
     target   => "/hxmtfs/home",
     force    => true,
     require  => File['/bio'],
   }
   file { "/home/cc":
     ensure   => link,
     target   => "/ihepfs/backup/ihepbatch/cc",
     force    => true,
     require  => File['/bio'],
   }
   file { "/home/bsrf":
     ensure   => link,
     target   => "/ihepbatch/bsrf",
     force    => true,
     require  => File['/bio'],
   }
   file { "/home/msdl":
     ensure   => link,
     target   => "/ihepfs/msdl/user",
     force    => true,
     require  => File['/bio'],
   }
   #file { "/home/csns":
   #  ensure   => absent,
   #}

   file { "/atlas/codesbackup":
     ensure   => link,
     target   => "/publicfs/atlas/codesbackup",
     force    => true,
     require  => File['/bio'],
   }

   file { "/lhcb/user":
     ensure   => link,
     target   => "/publicfs/lhcb/user",
     force    => true,
     require  => File['/bio'],
   }

   file { "/lhcb/data":
     ensure   => link,
     target   => "/publicfs/lhcb/data",
     force    => true,
     require  => File['/bio'],
   }


   file { "/cms/user":
     ensure   => link,
     target   => "/publicfs/cms/user",
     force    => true,
     require  => File['/bio'],
   }
   file { "/opt/exp_soft":
     ensure   => absent,
   }
   file { "/mbh/mbhd01":
     ensure   => link,
     target   => "/ihepbatch/mbhd01",
     force    => true,
     require  => File['/bio'],
   }
   file { "/cac/data":
     ensure   => link,
     target   => "/eos/public/cac/data",
     force    => true,
     require  => File['/bio'],
   }
   file { "/map/dicp":
     ensure   => link,
     target   => "/publicfs/dicp",
     force    => true,
     require  => File['/bio'],
   }
   file { "/nano/data":
     ensure   => link,
     target   => "/eos/public/nano/data",
     force    => true,
     require  => File['/bio'],
   }
   file { "/bio/data":
     ensure   => link,
     target   => "/eos/public/bio/data",
     force    => true,
     require  => File['/bio'],
   }
   case $operatingsystemmajrelease {
   '5': {
      #file { "/usr/kerberos/bin/kpasswd":
      #  ensure   => link,
      #  target   => "/afs/ihep.ac.cn/bin/lib64/kpasswd.openafs",
      #  force    => true,
      #  require  => File['/bio'],
      #}
      file {"/usr/kerberos/bin/passwd":
       mode         =>  '0755',
       owner        =>  'root',
       group        =>  'root',
       source       =>  "puppet:///modules/${module_name}/passwd",
       require      =>  File['/root/.ssh']
     }
      file {"/usr/bin/passwd":
       mode         =>  '0755',
       owner        =>  'root',
       group        =>  'root',
       source       =>  "puppet:///modules/${module_name}/passwd",
     }
   }
  '6': {
      #file { "/usr/bin/kpasswd":
      #  ensure   => link,
      #  target   => "/afs/ihep.ac.cn/bin/lib64/kpasswd.openafs",
      #  force    => true,
      #  require  => File['/bio'],
      #}
      #file {"/usr/bin/passwd":
      # mode         =>  '0755',
      # owner        =>  'root',
      # group        =>  'root',
      # source       =>  "puppet:///modules/${module_name}/passwd",
      #}
   }
  }
}
